package
{
	public class AchievementInfo
	{
		protected var icon:Class;
		protected var incompText:String;
		protected var compText:String;
		
		protected var requirement:int;
		protected var progress:int;
		
		public function AchievementInfo(icon:Class, compText:String, incompText:String, req:int, pro:int)
		{
			this.icon = icon;
			this.compText = compText;
			this.incompText = incompText;
			this.requirement = req;
			this.progress = pro;
		}
		
		/**
		 * returns image class
		 */
		public function getIcon():Class {
			if (complete()) {
				return icon;
			} else {
				return Res.lockedAchiev;
			}
		}
		
		/**
		 * returns text
		 */
		public function getText():String {
			if (complete()) {
				return compText;
			} else {
				return incompText;
			}
		}
		
		/**
		 * returns requirement
		 */
		public function getRequirement():int {
			return requirement;
		}
		
		/**
		 * returns progrss
		 */
		public function getProgress():int {
			return progress;
		}
		
		/**
		 * if true then the achievement should be queued to be shown to the user.
		 */
		public function justCompleted():Boolean {
			return progress == requirement;
		}
		
		/**
		 * true if the achievement has been completed
		 */
		public function complete():Boolean {
			return progress >= requirement;
		}
		
		/** 
		 * increments progress to completion by amount
		 */
		public function incrementProgress(amount:int = 1):void {
			progress += amount;
		}
	}
}